﻿using System;
using System.Collections.Generic;
using System.Data.SqlClient;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace _066.App
{
    public  class SqlDA
    {
        SqlConnection _con;
        SqlCommand _cmd;

        public void Add(SqlData data)
        {
            SqlCommand _cmd;

            //打开连接，拼接命令
            _con.Open();
            _cmd = _con.CreateCommand();
            _cmd.CommandText = "update Temp_users set name=@name,pwd=@pwd where code=@code";
            _cmd.Parameters.Add("@name", data.Name);
            _cmd.Parameters.Add("@pwd", data.Pwd);
            _cmd.Parameters.Add("@code", data.Code);
            //执行命令，关闭连接
            _cmd.ExecuteNonQuery();
            _con.Close();
        }

    }
}
